package com.csyaonie.android;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.csyaonie.android.grideview.GrideViewActivity;
import com.csyaonie.android.listview.ListViewActivity;
import com.csyaonie.android.recyclerview.RecyclerViewActivity;

public class UiActivity extends AppCompatActivity {

    private Button layoutBt;

    private Button textViewBt;

    private Button buttonBt;

    private Button editTextBt;

    private Button radioButtonBt;

    private Button checkboxButtonBt;

    private Button imageViewBt;

    private Button listviewBt;

    private Button grideviewBt;

    private Button recyclerviewBt;

    private Button webview_bt;

    private Button toast_bt;

    private Button dialog_bt;

    private Button custom_dialog_bt;

    private Button progress_bt;

    private Button popup_bt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ui);
        layoutBt = findViewById(R.id.layout_bt);
        textViewBt = findViewById(R.id.text_view_bt);
        buttonBt = findViewById(R.id.button_bt);
        editTextBt = findViewById(R.id.edit_text_bt);
        radioButtonBt = findViewById(R.id.radio_button_bt);
        checkboxButtonBt = findViewById(R.id.checkbox_button_bt);
        imageViewBt = findViewById(R.id.image_button_bt);
        listviewBt = findViewById(R.id.listview_bt);
        grideviewBt = findViewById(R.id.grideview_bt);
        recyclerviewBt=findViewById(R.id.recyclerview_bt);
        webview_bt=findViewById(R.id.webview_bt);
        toast_bt=findViewById(R.id.toast_bt);
        dialog_bt=findViewById(R.id.dialog_bt);
        custom_dialog_bt=findViewById(R.id.custom_dialog_bt);
        progress_bt=findViewById(R.id.progress_bt);
        popup_bt=findViewById(R.id.popup_bt);
        setListener();
    }

    public void setListener(){
        Onclick onclick=new Onclick();
        layoutBt.setOnClickListener(onclick);
        textViewBt.setOnClickListener(onclick);
        buttonBt.setOnClickListener(onclick);
        editTextBt.setOnClickListener(onclick);
        radioButtonBt.setOnClickListener(onclick);
        checkboxButtonBt.setOnClickListener(onclick);
        imageViewBt.setOnClickListener(onclick);
        listviewBt.setOnClickListener(onclick);
        grideviewBt.setOnClickListener(onclick);
        recyclerviewBt.setOnClickListener(onclick);
        webview_bt.setOnClickListener(onclick);
        toast_bt.setOnClickListener(onclick);
        dialog_bt.setOnClickListener(onclick);
        custom_dialog_bt.setOnClickListener(onclick);
        progress_bt.setOnClickListener(onclick);
        popup_bt.setOnClickListener(onclick);
    }

    public class Onclick implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            Intent intent = null;
            switch (v.getId()) {
                case R.id.layout_bt:
                    intent = new Intent(UiActivity.this, LayoutActivity.class);
                    break;
                case R.id.text_view_bt:
                    intent = new Intent(UiActivity.this, TextViewActivity.class);
                    break;
                case R.id.button_bt:
                    intent = new Intent(UiActivity.this, ButtonActivity.class);
                    break;
                case R.id.edit_text_bt:
                    intent = new Intent(UiActivity.this, EditTextActivity.class);
                    break;
                case R.id.radio_button_bt:
                    intent = new Intent(UiActivity.this, RadioButtonActivity.class);
                    break;
                case R.id.checkbox_button_bt:
                    intent = new Intent(UiActivity.this, CheckBoxActivity.class);
                    break;
                case R.id.image_button_bt:
                    intent = new Intent(UiActivity.this, ImageViewActivity.class);
                    break;
                case R.id.listview_bt:
                    intent = new Intent(UiActivity.this, ListViewActivity.class);
                    break;
                case R.id.grideview_bt:
                    intent = new Intent(UiActivity.this, GrideViewActivity.class);
                    break;
                case R.id.recyclerview_bt:
                    intent = new Intent(UiActivity.this, RecyclerViewActivity.class);
                    break;
                case R.id.webview_bt:
                    intent = new Intent(UiActivity.this, WebViewActivity.class);
                    break;
                case R.id.toast_bt:
                    intent = new Intent(UiActivity.this, ToastActivity.class);
                    break;
                case R.id.dialog_bt:
                    intent = new Intent(UiActivity.this, DialogActivity.class);
                    break;
                case R.id.custom_dialog_bt:
                    intent = new Intent(UiActivity.this, CustomDialogActivity.class);
                    break;
                case R.id.progress_bt:
                    intent = new Intent(UiActivity.this, ProgressBarActivity.class);
                    break;
                case R.id.popup_bt:
                    intent = new Intent(UiActivity.this, PopupWindowActivity.class);
                    break;
            }
            startActivity(intent);
        }
    }
}